| def openfile(): | |
| """Opens a file on the local storage via a File | Open dialog box | |
| Returns: | |
| str: The full path to the file selected via the File | Open dialog or "" if no file was selected | |
| """ | |
| # Hide the additional dialog box | |
| root = tk.Tk() | |
| root.withdraw() | |
| root.wm_attributes('-topmost', 1) | |
| # Show the file open dailog box and return the filename | |
| filename = askopenfilename(initialdir=os.getcwd(), title="Choose Input File", filetypes = (("Word Documents","*.docx"),("Text Files","*.txt"))) | |
| return filename |